package com.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.demo.entity.Message;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;

/**
 * 消息记录表 Mapper 接口
 * @author zm
 * @since 2020-11-24
 */
public interface MessageMapper extends BaseMapper<Message> {

    @Select("select * from pd_message where doctor_advice_id = #{doctorAdviceId} limit 1")
    Message queryByDoctorAdviceId(@Param("doctorAdviceId") Integer doctorAdviceId);

    @Select("select * from pd_message where doctor_advise_id = #{doctorAdviceId} and created_time between #{startTime} and #{endTime} limit 1")
    Message queryByCondition(@Param("doctorAdviceId") Integer doctorAdviceId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
}
